#ifndef SHUI_COLORBUTTON_H
#define SHUI_COLORBUTTON_H

#include <QToolButton>
#include "tool/defines.h"

namespace ShUi
{

class ColorButtonImpl;
class ColorButton : public QToolButton
{
    Q_OBJECT
public:
    explicit ColorButton(const QColor& color, QWidget* parent = 0);
    explicit ColorButton(QWidget* parent = 0);
    ~ColorButton();

    QColor color() const;
    
signals:
    void colorChanged(const QColor& color);
    
public slots:
    void setColor(const QColor& color);
    void setColor(int r, int g, int b);

private slots:
    void onClicked();

protected:
    void paintEvent(QPaintEvent* evt);
    
private:
    SH_DISABLE_COPY(ColorButton);
    SH_DECLARE_IMPL(ColorButton);
};

} // namespace ShUi

#endif // SHUI_COLORBUTTON_H
